package lanou.giftsay_01.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import lanou.giftsay_01.R;
import lanou.giftsay_01.bean.DanpinBean;

/**
 * Created by dllo on 16/8/19.
 */
public class LeftAdapter extends BaseAdapter{
    private DanpinBean danpinBean ;
    private Context context ;

    public void setDanpinBean(DanpinBean danpinBean) {
        this.danpinBean = danpinBean;
    }

    public LeftAdapter(Context context) {
        this.context = context;
    }

    @Override
    public int getCount() {
        return danpinBean != null ? danpinBean.getData().getCategories().size() : 0;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_left , parent ,false);
        TextView tv = (TextView) view.findViewById(R.id.left_tv);
        tv.setTag(position);
        tv.setText(danpinBean.getData().getCategories().get(position).getName());
        return view;
    }
}
